package com.zhixue.content.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Auther: 李 力
 * @Date: 2025/5/7
 * @Description: com.zhixue.content.feignclient
 * @version: 1.0
 */
@Component
@Slf4j
public class MediaServiceClientFallbackFactory implements FallbackFactory<MediaServiceClient> {

    @Override
    public MediaServiceClient create(Throwable throwable) {
        return new MediaServiceClient() {
            @Override
            public String upload(MultipartFile filedata, String objectName) {
                log.error("媒资系统异常，暂时无法提供服务:{}", throwable.getMessage(), throwable);
                return null;
            }
        };
    }
}
